﻿using System.Collections.Generic;
using Assets.Scripts.Net.Data.Model;
using Newtonsoft.Json.Linq;

namespace Assets.Scripts.Net.Data.Reader
{
    /// <summary>
    /// 学生信息
    /// </summary>
    public class StudentInfoReader:NetInfoReaderBase
    {
        public StudentInfoReader(Dictionary<string, object> dict) : base(dict)
        {
            if(dict==null)return;
            StudentInfo info=new StudentInfo();
            AutoSetValue<StudentInfo>(dict,info);
            AddInfoToFactory<StudentInfo>(info);
            if (dict.ContainsKey("relativedata"))//亲属
            {
                List<object> list = dict["relativedata"] as List<object>;
                NetReaderFactory.Instance().ReaderInfo(ReaderInfoType.RelativeInfo, null, list);
            }
            if (dict.ContainsKey("studyexpdata"))//学习经历
            {
                List<object> list = dict["studyexpdata"] as List<object>;
                NetReaderFactory.Instance().ReaderInfo(ReaderInfoType.StudyExpInfo, null, list);
            }
            if (dict.ContainsKey("studydata"))//学习成绩
            {
                List<object> list = dict["studydata"] as List<object>;
                NetReaderFactory.Instance().ReaderInfo(ReaderInfoType.StudyInfo, null, list);
            }
            if (dict.ContainsKey("cpexpdata"))//课堂表现
            {
                List<object> list = dict["cpexpdata"] as List<object>;
                NetReaderFactory.Instance().ReaderInfo(ReaderInfoType.CPExpInfo, null, list);
            }
            if (dict.ContainsKey("remarkdata"))//班主任评语
            {
                List<object> list = dict["remarkdata"] as List<object>;
                NetReaderFactory.Instance().ReaderInfo(ReaderInfoType.RemarkInfo, null, list);
            }
        }
    }
}